package com.example.controller;

import com.example.consumer.Tiktok;
import com.example.entity.VideoMessage;
import com.example.entity.RestBean;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/video")
public class TiktokController {

    @Resource
    Tiktok tiktok;

    @GetMapping("/tiktok")
    public RestBean<List<VideoMessage>> getLogisticsMessages() {
        try {
            List<VideoMessage> messages = tiktok.getMessages();

            return RestBean.success(messages);
        } catch (Exception e) {
            e.printStackTrace();
            return RestBean.serverError("服务器处理失败", e.getMessage());
        }
    }

}
